<template>
	<view >

		<view v-if="empInfo" class="">
			<view  class="tickets-dynamic-box">
				<scBg  :type="2" :height="700" :width="600">
					<view class="row-center" style="margin: 15px 15px;padding-top: 15px;">
						<view class="" style="font-size: 20px;color: #797979;">
							姓名：
						</view>
						<view class="" style="font-size: 20px;font-weight: 600;color: #000000;">
							{{empInfo.ename}}
						</view>
					</view>
					<view class="row-center" style="margin: 15px 15px;padding-top: 15px;">
						<view class="" style="font-size: 20px;color: #797979;">
							工号：
						</view>
						<view class="" style="font-size: 20px;font-weight: 600;color: #000000;">
							{{empInfo.wid}}
						</view>
					</view>
					<view class="row-center" style="margin: 15px 15px;padding-top: 15px;">
						<view class="" style="font-size: 20px;color: #797979;">
							所属单位：
						</view>
						<view class="" style="font-size: 20px;font-weight: 600;color: #000000;">
							{{empInfo.oneDept?empInfo.oneDept:'无'}}
						</view>
					</view>
					<!-- <view class="row-center" style="margin: 15px 15px;padding-top: 15px;">
						<view class="" style="font-size: 20px;color: #797979;">
							所属二级单位：
						</view>
						<view class="" style="font-size: 20px;font-weight: 600;color: #000000;">
							{{empInfo.two_dept?empInfo.two_dept:'无'}}
						</view>
					</view> -->
					<view class="row-center" style="margin: 15px 15px;padding-top: 15px;">
						<view class="" style="font-size: 20px;color: #797979;">
							充值号：
						</view>
						<view class="" style="font-size: 20px;font-weight: 600;color: #000000;">
							{{empInfo.icCard?empInfo.icCard:'无'}}
						</view>
					</view>
					
					<view class="row-center" style="margin: 15px 15px;padding-top: 15px;">
						<view class="" style="font-size: 20px;color: #797979;">
							有效期：
						</view>
						<view class="" style="font-size: 20px;font-weight: 600;color: #000000;">
							2023年07月31日前
						</view>
					</view>
				</scBg>
			</view>
			
			<view class="wrap">
				<view class="exam-zhang display-flex">
					<view style="flex: .7;">
						单位印章：
					</view>
					<view>
						<image class="zhang-img" src="https://qiniu.gybsky.cn/qsbsimage/public/maintain/2023/06/29/9c4e4ef4bdc14fb797181ea25027a39c0wiwlsj2la.gif">
							<view class="zhang-time">2023年07月01日</view>
					</view>
				</view>
			
			</view>
		</view>
		
		<view v-else >
			<view class="" style="background-color: #FFFFFF;margin: 10px;border-radius: 10px;padding: 10px;">
				<view style="margin: 15px 0;text-align: center;font-size: 16px;color: #000000;font-weight: 600;">
					请填写工号
				</view>
				<view class="" style="padding: 0 15px;">
				
					<form >
						
						<view class="uni-form-item uni-column row-center">
							<view class="title">工号：</view>
							<input  class="uni-input" style="flex:1;border-bottom: 1px solid #eee;padding: 8px;" v-model="wid"  maxlength="10" name="number" placeholder="请输入工号" />
						</view>
					</form>
				</view>
			</view>
			<view class="popup-button"  @click="getEmpInfo">
				提交
			</view>
		</view>
		
		<!-- <u-popup v-model="EmpShow" width="600" mode="center" :mask-close-able="false" border-radius="8" :mask-custom-style="background">
			
		</u-popup> -->
	</view>
</template>

<script>
	import scBg from '@/components/bg/index'
	import {getIcCard} from "@/api/api"
	
	export default {
		components: {
			scBg
		},
		data() {
			return {
				
				empInfo:'',
				background:{background: 'rgba(0, 0, 0, 0.85)'},
				EmpShow:true,
				wid: '',
				
			}
		},
		onLoad(option) {
		
		
		},

		onReady() {

		},
		methods: {
			getEmpInfo(){
				let that = this
				
				if(!this.wid){
					return this.$util.Tips({title: "请填写工号"})
				}
				
				if(this.wid.length > 6){
					return this.$util.Tips({title: "工号不能大于32个字"})
				}
				
				uni.showLoading({
					title:'正在领取中'
				})
				getIcCard({wid: this.wid}).then(res => {
					that.empInfo = res.data  
					uni.hideLoading();
						
				}).catch(err => {
					uni.hideLoading();
					return that.$util.Tips({
						title: err
					});
				});
			}
		}
	};
</script>

<style scoped lang="scss">
	page {
		background-color: #f7f7f7;
	}
.tickets-dynamic-box {
		display: flex;
		flex-direction: column;
		// align-items: center;
	}

	.button-k {
		border-radius: 36rpx;
		border: 2rpx solid #26a2ff;
		font-size: 32rpx;
		display: inline-block;
		color: #26A2FF;
	}
	.wrap {
		padding: 30rpx;
		background-color: #FFFFFF;
		margin: 10px 35px 0 35px;
		border-radius: 5px;
	}
	.zhang-img {
		width: 105px;
		height: 100px;
	}
	
	.zhang-time {
		color: #000;
		font-weight: 600;
		position: absolute;
		margin-top: -35px;
		margin-left: -15px;
	}
	
	.popup-button{
		background-color: #007AFF;
		height: 45px;
		line-height: 45px;
		border-radius: 4px;
		margin: 30px 20px 20px 20px;
		text-align: center;
		color: #FFFFFF;
	}
	
</style>